/* =================================================
 * Package:			dk.iha.toksEditor
 * File:			TOKS.java
 * Description:		TOKS data container.
 * 
 * Responsible
 * =================================================
 * Name:			Bjarke Jensen
 * Study number:	09676
 */

package dk.iha.toksEditor;

import java.util.Date;

import org.json.JSONObject;


public class TOKS {
	private Date date;
	
	private Integer respirationFrequency;
	private Integer bloodPressureSystolic;
	private Integer heartRate;
	private Double temperature;

	private Integer saturation;
	private Integer bloodPressureDiastolic;
	private String consciousness;
	private Double oxygenLitersPerMinute;
	private String decisionAlgorithm;
	private Integer totalScore;
	
	@Override
	public String toString()
	{
		JSONObject jo = new JSONObject();
		try
		{
			jo.put("totalScore", totalScore);
			jo.put("decisionAlgorithm", decisionAlgorithm);
			jo.put("oxygenLitersPerMinute", oxygenLitersPerMinute);
			jo.put("consciousness", consciousness);
			jo.put("bloodPressureDiastolic", bloodPressureDiastolic);
			jo.put("saturation", saturation);
			jo.put("temperature", temperature);
			jo.put("heartRate", heartRate);
			jo.put("bloodPressureSystolic", bloodPressureSystolic);
			jo.put("respirationFrequency", respirationFrequency);
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		
		return jo.toString();		
	}
	
	/**
	 * 
	 * @return Integer containing RespirationFrequency
	 */
	public Integer getRespirationFrequency() 
	{
		if(respirationFrequency != null)
			return respirationFrequency;
		else
			return 0;
	}

	/**
	 * 
	 * @param respirationFrequency to set respirationFrequency
	 */
	public void setRespirationFrequency(Integer respirationFrequency) {
		this.respirationFrequency = respirationFrequency;
	}
	
	/**
	 * 
	 * @return Integer containing BloodPressureSystolic
	 */
	public Integer getBloodPressureSystolic() {
		if(bloodPressureSystolic != null)
			return bloodPressureSystolic;
		else
			return 0;
	}

	/**
	 * 
	 * @param bloodPressureSystolic to set bloodPressureSystolic
	 */
	public void setBloodPressureSystolic(Integer bloodPressureSystolic) {
		this.bloodPressureSystolic = bloodPressureSystolic;
	}

	/**
	 * 
	 * @return Integer containing HeartRate
	 */
	public Integer getHeartRate() {
		if(heartRate != null)
			return heartRate;
		else
			return 0;
	}

	/**
	 * 
	 * @param heartRate to set heartRate
	 */
	public void setHeartRate(Integer heartRate) {
		this.heartRate = heartRate;
	}

	/**
	 * 
	 * @return Double Containing Temperature.
	 */
	public Double getTemperature() {
		if(temperature != null && !temperature.isNaN())
			return temperature;
		else
			return 0.0;
	}

	/**
	 * 
	 * @param temperature to set temperature
	 */
	public void setTemperature(Double temperature) {
		this.temperature = temperature;
	}

	/**
	 * 
	 * @return Integer containing Saturation
	 */
	public Integer getSaturation() {
		if(saturation != null)
			return saturation;
		else return 0;
	}

	/**
	 * 
	 * @param saturation to set saturation
	 */
	public void setSaturation(Integer saturation) {
		this.saturation = saturation;
	}

	/**
	 * 
	 * @return Integer containing BloodPressureDiastolic
	 */
	public Integer getBloodPressureDiastolic() {
		if(bloodPressureDiastolic != null)
			return bloodPressureDiastolic;
		else
			return 0;
	}
	
	/**
	 * 
	 * @param bloodPressureDiastolic to set bloodPressureDiastolic
	 */
	public void setBloodPressureDiastolic(Integer bloodPressureDiastolic) {
		this.bloodPressureDiastolic = bloodPressureDiastolic;
	}

	/**
	 * 
	 * @return Double containing OxygenLitersPerMinute
	 */
	public Double getOxygenLitersPerMinute() {
		if(oxygenLitersPerMinute != null && !oxygenLitersPerMinute.isNaN())
			return oxygenLitersPerMinute;
		else
			return 0.0;
	}

	/**
	 * 
	 * @param oxygenLitersPerMinute to set oxygenLitersPerMinute
	 */
	public void setOxygenLitersPerMinute(Double oxygenLitersPerMinute) {
		this.oxygenLitersPerMinute = oxygenLitersPerMinute;
	}

	/**
	 * 
	 * @return Integer containing TotalScore
	 */
	public Integer getTotalScore() {
		if(totalScore != null)
			return totalScore;
		else 
			return 0;
	}

	/**
	 * 
	 * @param totalScore to set totalScore
	 */
	public void setTotalScore(Integer totalScore) {
		this.totalScore = totalScore;
	}

	/**
	 * 
	 * @return Date containing Date
	 */
	public Date getDate() {
		if(date != null)
			return date;
		else
			return new Date();
	}

	/**
	 * 
	 * @param date to set Date
	 */
	public void setDate(Date date) {
		this.date = date;
	}

	/**
	 * 
	 * @return String containing Consciousness
	 */
	public String getConsciousness() {
		if(consciousness != null)
			return consciousness;
		else
			return "";
	}

	/**
	 * 
	 * @param consciousness to set consciousness
	 */
	public void setConsciousness(String consciousness) {
		this.consciousness = consciousness;
	}

	/**
	 * 
	 * @return String containing DecisionAlgorithm
	 */
	public String getDecisionAlgorithm() {
		return decisionAlgorithm;
	}

	/**
	 * 
	 * @param decisionAlgorithm to set decisionAlgorithm
	 */
	public void setDecisionAlgorithm(String decisionAlgorithm) {
		this.decisionAlgorithm = decisionAlgorithm;
	}
}



